from langchain import OpenAI, ConversationChain
import os

#能记住上下文对话的对话链

os.environ["OPENAI_API_KEY"] = "sess-qCX1fF30AgyeRtGPXivJSiOjDBoTno5CksuRwhst"
llm = OpenAI(temperature=0)
conversation = ConversationChain(llm=llm, verbose=True)
output = conversation.predict(input="Hi there!")
print(output)
# Hello! It's nice to meet you. I am an AI created by OpenAI. I am constantly learning and improving my abilities through machine learning algorithms. How can I assist you today?
output = conversation.predict(input="I'm doing well! Just having a conversation with an AI.")
print(output)
#That's great to hear! I am always happy to engage in conversations and learn more about human interactions. Is there anything specific you would like to talk about?